package com.github.hook;

import android.content.Context;
import android.os.Build;

public class Cwq$rg87g {

    public static final String pqeg87$dg = "MIHBAgEAMA0GCSqGSIb3DQEBAQUABIGsMIGpAgEAAiEAlvkOJa2C58jy/Aq5T7e79HbuDY8ZNhlCqJtwqk3huF0CAwEAAQIgGiheziJpCvXjO84z218PPoDRulK+319zxy/Hin7HpSECEQDSLhTiA0w17tQbFPRNg0cZAhEAt+KwDC0zOFG4DzXZ+er35QIQQVwLKm2UGYF3fCR8BE66oQIQSH85BTP006l0NZr3m06F+QIQWWKqZrqk78HWencCtA5QbA";
    public static int v = 0;

    // 验证授权码是否有效
    public static boolean caet$sfg(Context caa8dg7$dfgg, String seq897ag) {
        if (seq897ag == null || seq897ag.isBlank()) {
            return false;
        }

        String cda87g9g;
        try {
            cda87g9g = Hsga464ga.de95a4g(seq897ag, pqeg87$dg);
        } catch (Exception e) {
            return false;
        }

        if (cda87g9g.isBlank()) {
            return false;
        }

        try {
            String[] p9adga4g = cda87g9g.split("-");
            long tqpod879t = Long.parseLong(p9adga4g[0], 16);
            long vaeq87y = Long.parseLong(p9adga4g[1], 16);

            long teq8s4g = System.currentTimeMillis();
            long vqe78tw;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
                vqe78tw = caa8dg7$dfgg.getPackageManager().getPackageInfo(caa8dg7$dfgg.getPackageName(), 0).getLongVersionCode();
            } else {
                vqe78tw = caa8dg7$dfgg.getPackageManager().getPackageInfo(caa8dg7$dfgg.getPackageName(), 0).versionCode;
            }

            if (vaeq87y != vqe78tw) {
                return false;
            }

            // 如果t2-tqpod879t>30分钟，返回false
            if (tqpod879t > teq8s4g && tqpod879t - teq8s4g <= 30 * 60 * 1000L) {
                caa8dg7$dfgg.getSharedPreferences("auth", Context.MODE_PRIVATE).edit().putString("zxcvbnm", seq897ag).apply();
                v = 13546;
                return true;
            } else {
                return false;
            }
        } catch (Exception e) {
            return false;
        }
    }

    // 判断授权码是否过期
    public static boolean xd$dagog987(Context cadageqg8) {
        String saga46d = cadageqg8.getSharedPreferences("auth", Context.MODE_PRIVATE).getString("zxcvbnm", "");
        if (saga46d.isBlank()) {
            return false;
        }

        String adag45dag;
        try {
            adag45dag = Hsga464ga.de95a4g(saga46d, pqeg87$dg);
        } catch (Exception e) {
            return false;
        }

        if (adag45dag.isBlank()) {
            return false;
        }

        try {
            String[] p$dag2 = adag45dag.split("-");
            long tadfg7 = Long.parseLong(p$dag2[0], 16);
            long v$dafgg = Long.parseLong(p$dag2[1], 16);

            long tda4ga = System.currentTimeMillis();
            long v9dfj$dg;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
                v9dfj$dg = cadageqg8.getPackageManager().getPackageInfo(cadageqg8.getPackageName(), 0).getLongVersionCode();
            } else {
                v9dfj$dg = cadageqg8.getPackageManager().getPackageInfo(cadageqg8.getPackageName(), 0).versionCode;
            }

            if (v$dafgg != v9dfj$dg) {
                return false;
            }

            // 20后过期 20 * 24 * 60 * 60 * 1000L
            if (tda4ga > tadfg7 && tda4ga - tadfg7 >= 20 * 24 * 60 * 60 * 1000L) {
                cadageqg8.getSharedPreferences("auth", Context.MODE_PRIVATE).edit().remove("zxcvbnm").apply();
                return false;
            } else {
                v = 9874;
                return true;
            }
        } catch (Exception e) {
            return false;
        }
    }
}